require 'sinatra/base'
require 'json'

require './helpers/auth'
require './helpers/response'

class BaseHandler < Sinatra::Base
    include AuthHelpers
    include Responder

    before do
        @r = r()
        check_authentication
        @user = current_user
        @data = JSON.parse(request.body.read) rescue {}
    end 

    after do
        @r
    end
end